package com.rm.questions.entity;

import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 题目修改日志对象 sh_tk_q_logs
 * 
 * @author sh
 * @date 2025-03-25
 */
@Data
public class CoreQLog implements Serializable
{
    private static final long serialVersionUID = 1L;

    /** 主键 */
    private Long id;

    /** 创建时间 */
    private LocalDateTime createTime;

    /** 日志类型 */
    private String logType;

    /** 题目ID */
    private Long questionId;

    /** 更新前所属分类ID */
    private Long preOwnerId;

    /** 更新前标题 */
    private String preTitle;

    /** 更新前问题选项 */
    private String preOptions;

    /** 更新前答案 */
    private String preAnswer;

    /** 更新前解析技巧 */
    private String preExplainSkill;

    /** 更新前问题解析 */
    private String preQuestionExplain;

    /** 更新前图片 */
    private String preImage;

    /** 更新后所属分类ID */
    private Long postOwnerId;

    /** 更新后标题 */
    private String postTitle;

    /** 更新后问题选项 */
    private String postOptions;

    /** 更新后答案 */
    private String postAnswer;

    /** 更新后解析技巧 */
    private String postExplainSkill;

    /** 更新后问题解析 */
    private String postQuestionExplain;

    /** 更新后图片 */
    private String postImage;

    public void setPreQuestion(CoreQuestion preQuestion){
        this.questionId = preQuestion.getId();
        this.preOwnerId = preQuestion.getOwnerId();
        this.preTitle = preQuestion.getTitle();
        this.preOptions = preQuestion.getOptions();
        this.preAnswer = preQuestion.getAnswer();
        this.preExplainSkill = preQuestion.getExplainSkill();
        this.preQuestionExplain = preQuestion.getQuestionExplain();
        this.preImage = preQuestion.getImage();
    }

    public void setPostQuestion(CoreQuestion postQuestion){
        this.questionId = postQuestion.getId();
        this.postOwnerId = postQuestion.getOwnerId();
        this.postTitle = postQuestion.getTitle();
        this.postOptions = postQuestion.getOptions();
        this.postAnswer = postQuestion.getAnswer();
        this.postExplainSkill = postQuestion.getExplainSkill();
        this.postQuestionExplain = postQuestion.getQuestionExplain();
        this.postImage = postQuestion.getImage();
    }

    public CoreQuestion getPreQuestion(){
        CoreQuestion preQuestion = new CoreQuestion();
        preQuestion.setId(questionId);
        preQuestion.setOwnerId(preOwnerId);
        preQuestion.setTitle(preTitle);
        preQuestion.setOptions(preOptions);
        preQuestion.setAnswer(preAnswer);
        preQuestion.setExplainSkill(preExplainSkill);
        preQuestion.setQuestionExplain(preQuestionExplain);
        preQuestion.setImage(preImage);
        return preQuestion;
    }

    public CoreQuestion getPostQuestion(){
        CoreQuestion postQuestion = new CoreQuestion();
        postQuestion.setId(questionId);
        postQuestion.setOwnerId(postOwnerId);
        postQuestion.setTitle(postTitle);
        postQuestion.setOptions(postOptions);
        postQuestion.setAnswer(postAnswer);
        postQuestion.setExplainSkill(preExplainSkill);
        postQuestion.setQuestionExplain(preQuestionExplain);
        postQuestion.setImage(preImage);
        return postQuestion;
    }

}
